﻿using System;
using System.Linq;
using LINQPad.Extensibility.DataContext;
using LINQPad.OpenAccess.Settings;

namespace LINQPad.OpenAccess.Services
{
    /// <summary>
    /// Used to build up the connection string 
    /// </summary>
    public interface IConnectionStringBuilder
    {
        /// <summary>
        /// Determines whether the instance is able to build the connection for the specified parameters.
        /// </summary>
        /// <param name="providerName">Name of the provider.</param>
        /// <param name="connectionSettings">The connection settings.</param>
        /// <returns>
        ///   <c>true</c> if the instance is able to build the connection string; otherwise, <c>false</c>.
        /// </returns>
        bool CanBuildConnectionStringFor( string providerName, ConnectionSettings connectionSettings = null );
        /// <summary>
        /// Builds the connection string for the specified parameters.
        /// </summary>
        /// <param name="providerName">Name of the provider.</param>
        /// <param name="connectionInfo">The connection info.</param>
        /// <param name="connectionSettings">The connection settings.</param>
        /// <returns>
        /// The connection string.
        /// </returns>
        string BuildConnectionString( string providerName, IConnectionInfo connectionInfo, ConnectionSettings connectionSettings = null );
    }
}
